import { http } from "@/utils/http";

export type ResultType = ReplaceTargetType<any[] | any>

/**
 * 实体/事件查询列表
 * @param params
 *  code:string 实体类型关系编码
 *  name:string  搜索值
 *  current:number 当前页
 *  type: number 1 实体 2 事件
 * @param current number 当前页
 * @param size  number 每页的数量
 */
export const getEntityType = (params) => {
  return http.request<ResultType>({
    url: "/kgManagerApi/entitytype/page",
    method: "get",
    params: {
      ...params
    }
  });
};

/**
 * 实体查询表格
 * @param params
 * code: string 事件编码
 * name: string 筛选名称
 * current: number 当前页
 * size: number 每页数量
 */
export const getEntityPage = (params) => {
  return http.request<ResultType>({
    url: "/kgManagerApi/kg-manager/manager/conduct-kg/v1.0/entity-page",
    method: "get",
    params: {
      ...params
    }
  });
};

// 实体类型查询详情
export const getEntityDetail = (vid) => {
  return http.request<ResultType>({
    url: `/kgManagerApi/kg-manager/manager/conduct-kg/v1.0/entity-detail/${vid}`,
    method: "get",
  });
};
/**
 * 实体列表删除
 * @param params
 */
export const deleteEntity = (params) => {
  return http.request<ResultType>({
    url: `/kgManagerApi/kg-manager/manager/conduct-kg/v1.0/entity-delete`,
    method: "post",
    params:{
      ...params
    }
  });
};
/**
 * 实体详情编辑
 * @param params
 */
export const updateEntity = (data) => {
  return http.request<ResultType>({
    url: `/kgManagerApi/kg-manager/manager/conduct-kg/v1.0/entity-update`,
    method: "post",
    data
  });
};
